import Vue from 'vue'
import Router from 'vue-router'

const Home = () => import('@/components/Home.vue')
const Register = () => import('@/components/Register.vue')
const Login = () => import('@/components/Login.vue')
const Contacts = () => import('@/components/Contacts.vue')
const Books = () => import('@/components/Books.vue')
const AddPage = () => import('@/components/AddPage.vue')
const Center = () => import('@/components/Center.vue')

Vue.use(Router)

export default new Router({
  routes: [
    { path: '/', redirect: '/home/register' },
    {
      path: '/home',
      component: Home,
      children: [
        { path: 'register', component: Register },
        { path: 'login', component: Login }
      ]
    },
    { 
      path: '/contacts',
      component: Contacts,
      children: [
        { path: '', component: Books },
        { path: 'add', component: AddPage },
        { path: 'center', component: Center }
      ] 
    }
  ],
  mode: 'history'
})
